<?php

/**
 * @Project NUKEVIET 3.3
 * @Author VINADES.,JSC (contact@vinades.vn)
 * @Copyright (C) 2010 - 2011 VINADES.,JSC. All rights reserved
 * @Createdate Sat, 10 Dec 2011 06:46:54 GMT
 */

if (! defined ( 'NV_SYSTEM' ) and ! defined ( 'NV_ADMIN' ) and ! defined ( 'NV_WYSIWYG' )) {
	Header ( "Location: index.php" );
	exit ();
}
define ( 'NV_MAINFILE', true );
define ( 'NV_START_TIME', array_sum ( explode ( " ", microtime () ) ) );
$db_config = $global_config = $module_config = $client_info = $user_info = $admin_info = $sys_info = $lang_global = $lang_module = $rss = $nv_vertical_menu = $array_mod_title = $content_type = $blocks = $submenu = $select_options = $error_info = $rewrite = $countries = $newCountry = array ();
$page_title = $key_words = $canonicalUrl = $mod_title = $editor_password = $my_head = $my_footer = $description = $contents = "";
$editor = $rewrite = false;
define ( 'NV_ROOTDIR', pathinfo ( str_replace ( DIRECTORY_SEPARATOR, '/', __file__ ), PATHINFO_DIRNAME ) );
$sys_info ['disable_classes'] = (($disable_classes = ini_get ( "disable_classes" )) != "" and $disable_classes != false) ? array_map ( 'trim', preg_split ( "/[\s,]+/", $disable_classes ) ) : array ();
$sys_info ['disable_functions'] = (($disable_functions = ini_get ( "disable_functions" )) != "" and $disable_functions != false) ? array_map ( 'trim', preg_split ( "/[\s,]+/", $disable_functions ) ) : array ();
if (extension_loaded ( 'suhosin' )) {
	$sys_info ['disable_functions'] = array_merge ( $sys_info ['disable_functions'], array_map ( 'trim', preg_split ( "/[\s,]+/", ini_get ( "suhosin.executor.func.blacklist" ) ) ) );
}
$sys_info ['ini_set_support'] = (function_exists ( 'ini_set' ) and ! in_array ( 'ini_set', $sys_info ['disable_functions'] )) ? true : false;
require (NV_ROOTDIR . "/includes/constants.php");
if (file_exists ( NV_ROOTDIR . "/" . NV_CONFIG_FILENAME )) {
	require (realpath ( NV_ROOTDIR . "/" . NV_CONFIG_FILENAME ));
} else {
	if (file_exists ( NV_ROOTDIR . '/install/index.php' )) {
		$base_siteurl = pathinfo ( $_SERVER ['PHP_SELF'], PATHINFO_DIRNAME );
		if ($base_siteurl == DIRECTORY_SEPARATOR)
			$base_siteurl = '';
		if (! empty ( $base_siteurl ))
			$base_siteurl = str_replace ( DIRECTORY_SEPARATOR, '/', $base_siteurl );
		if (! empty ( $base_siteurl ))
			$base_siteurl = preg_replace ( "/[\/]+$/", '', $base_siteurl );
		if (! empty ( $base_siteurl ))
			$base_siteurl = preg_replace ( "/^[\/]*(.*)$/", '/\\1', $base_siteurl );
		if (defined ( 'NV_ADMIN' )) {
			$base_siteurl = preg_replace ( "#/" . NV_ADMINDIR . "(.*)$#", '', $base_siteurl );
		}
		if (! empty ( $base_siteurl ))
			$base_siteurl = preg_replace ( "#/index\.php(.*)$#", '', $base_siteurl );
		Header ( "Location: " . $base_siteurl . "/install/index.php" );
	}
	die ();
}
require (NV_ROOTDIR . "/" . NV_DATADIR . "/config_global.php");
if ($global_config ['getloadavg'])
	require (NV_ROOTDIR . "/includes/getloadavg.php");
$global_config ['file_allowed_ext'] = ! empty ( $global_config ['file_allowed_ext'] ) ? explode ( ",", $global_config ['file_allowed_ext'] ) : array ();
$global_config ['forbid_extensions'] = ! empty ( $global_config ['forbid_extensions'] ) ? explode ( ",", $global_config ['forbid_extensions'] ) : array ();
$global_config ['forbid_mimes'] = ! empty ( $global_config ['forbid_mimes'] ) ? explode ( ",", $global_config ['forbid_mimes'] ) : array ();
$global_config ['allow_sitelangs'] = ! empty ( $global_config ['allow_sitelangs'] ) ? explode ( ",", $global_config ['allow_sitelangs'] ) : array ();
$global_config ['allow_adminlangs'] = ! empty ( $global_config ['allow_adminlangs'] ) ? explode ( ",", $global_config ['allow_adminlangs'] ) : array ();
$global_config ['openid_servers'] = ! empty ( $global_config ['openid_servers'] ) ? explode ( ",", $global_config ['openid_servers'] ) : array ();
if (empty ( $global_config ['openid_servers'] ))
	$global_config ['openid_mode'] = 0;
if ($global_config ['is_user_forum']) {
	$forum_files = @scandir ( NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet' );
	if (! empty ( $forum_files ) and in_array ( 'is_user.php', $forum_files ) and in_array ( 'changepass.php', $forum_files ) and in_array ( 'editinfo.php', $forum_files ) and in_array ( 'login.php', $forum_files ) and in_array ( 'logout.php', $forum_files ) and in_array ( 'lostpass.php', $forum_files ) and in_array ( 'register.php', $forum_files )) {
		define ( 'NV_IS_USER_FORUM', true );
	} else {
		$global_config ['is_user_forum'] = 0;
	}
}
if ($global_config ['openid_mode']) {
	define ( 'NV_OPENID_ALLOWED', true );
	$openid_servers = array ();
	require (NV_ROOTDIR . '/includes/openid.php');
	$openid_servers = array_intersect_key ( $openid_servers, array_flip ( $global_config ['openid_servers'] ) );
}
require (NV_ROOTDIR . '/includes/class/ips.class.php');
$ips = new ips ();
$client_info ['ip'] = $ips->remote_ip;
if ($client_info ['ip'] == "none")
	die ( 'Error: Your IP address is not correct' );
define ( 'NV_FORWARD_IP', $ips->forward_ip );
define ( 'NV_REMOTE_ADDR', $ips->remote_addr );
define ( 'NV_CLIENT_IP', $client_info ['ip'] );
require (NV_ROOTDIR . '/includes/countries.php');
$client_info ['country'] = nv_getCountry_from_cookie ( $client_info ['ip'] );
require (NV_ROOTDIR . '/includes/timezone.php');
define ( 'NV_CURRENTTIME', isset ( $_SERVER ['REQUEST_TIME'] ) ? $_SERVER ['REQUEST_TIME'] : time () );
$global_config ['log_errors_list'] = NV_LOG_ERRORS_LIST;
$global_config ['display_errors_list'] = NV_DISPLAY_ERRORS_LIST;
$global_config ['send_errors_list'] = NV_SEND_ERRORS_LIST;
$global_config ['error_log_path'] = NV_LOGS_DIR . '/error_logs';
$global_config ['error_log_filename'] = NV_ERRORLOGS_FILENAME;
$global_config ['error_log_fileext'] = NV_LOGS_EXT;
require (NV_ROOTDIR . '/includes/class/error.class.php');
$ErrorHandler = new Error ( $global_config );
set_error_handler ( array (
		&$ErrorHandler,
		'error_handler' 
) );
if (empty ( $global_config ['allow_sitelangs'] ) or empty ( $global_config ['allow_adminlangs'] )) {
	trigger_error ( "Error! Language variables is empty!", 256 );
}
require (NV_ROOTDIR . "/includes/ini.php");
require (NV_ROOTDIR . '/includes/functions.php');
require (NV_ROOTDIR . '/includes/core/theme_functions.php');
require (NV_ROOTDIR . "/includes/class/xtemplate.class.php");
$global_config ['allow_request_mods'] = NV_ALLOW_REQUEST_MODS != '' ? array_map ( "trim", explode ( ",", NV_ALLOW_REQUEST_MODS ) ) : "request";
$global_config ['request_default_mode'] = NV_REQUEST_DEFAULT_MODE != '' ? trim ( NV_REQUEST_DEFAULT_MODE ) : 'request';
$global_config ['XSS_replaceString'] = NV_XSS_REPLACESTRING != '' ? NV_XSS_REPLACESTRING : '';
$global_config ['cookie_key'] = $global_config ['sitekey'];
$global_config ['cookie_secure'] = NV_COOKIE_SECURE;
$global_config ['cookie_httponly'] = NV_COOKIE_HTTPONLY;
$global_config ['session_save_path'] = NV_SESSION_SAVE_PATH;
if (nv_is_banIp ( $client_info ['ip'] ))
	trigger_error ( "Hi and Good-bye!!!", 256 );
if ($global_config ['proxy_blocker'] != 0) {
	$client_info ['is_proxy'] = $ips->nv_check_proxy ();
	if (nv_is_blocker_proxy ( $client_info ['is_proxy'], $global_config ['proxy_blocker'] )) {
		trigger_error ( 'ERROR: You are behind a proxy server. Please disconnect and come again!', 256 );
	}
}
$global_config ['engine_allowed'] = array ();
if (file_exists ( NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml' )) {
	$global_config ['engine_allowed'] = nv_object2array ( simplexml_load_file ( NV_ROOTDIR . '/' . NV_DATADIR . '/search_engine.xml' ) );
}
$language_array = nv_parse_ini_file ( NV_ROOTDIR . '/includes/ini/langs.ini', true );
if (defined ( 'NV_SYSTEM' )) {
	require (NV_ROOTDIR . '/includes/request_uri.php');
}
require (NV_ROOTDIR . '/includes/class/request.class.php');
$nv_Request = new Request ( $global_config, $client_info ['ip'] );
define ( 'NV_SERVER_NAME', $nv_Request->server_name );
define ( 'NV_SERVER_PROTOCOL', $nv_Request->server_protocol );
define ( 'NV_SERVER_PORT', $nv_Request->server_port );
define ( 'NV_MY_DOMAIN', $nv_Request->my_current_domain );
define ( 'NV_HEADERSTATUS', $nv_Request->headerstatus );
define ( 'NV_USER_AGENT', $nv_Request->user_agent );
define ( "NV_BASE_SITEURL", $nv_Request->base_siteurl . '/' );
define ( "NV_BASE_ADMINURL", $nv_Request->base_adminurl . '/' );
define ( 'NV_DOCUMENT_ROOT', $nv_Request->doc_root );
define ( 'NV_EOL', (strtoupper ( substr ( PHP_OS, 0, 3 ) == 'WIN' ) ? "\r\n" : (strtoupper ( substr ( PHP_OS, 0, 3 ) == 'MAC' ) ? "\r" : "\n")) );
define ( 'NV_UPLOAD_MAX_FILESIZE', min ( nv_converttoBytes ( ini_get ( 'upload_max_filesize' ) ), nv_converttoBytes ( ini_get ( 'post_max_size' ) ), $global_config ['nv_max_size'] ) );
define ( 'NV_UPLOADS_REAL_DIR', NV_ROOTDIR . '/' . NV_UPLOADS_DIR );
define ( 'NV_CACHE_PREFIX', md5 ( $global_config ['sitekey'] . NV_BASE_SITEURL ) );
require (NV_ROOTDIR . '/includes/language.php');
require (NV_ROOTDIR . "/language/" . NV_LANG_INTERFACE . "/global.php");
if (NV_LANG_DATA == "vi") {
	require_once (NV_ROOTDIR . '/includes/core/amlich.php');
}
$global_config ['cookie_path'] = $nv_Request->cookie_path;
$global_config ['cookie_domain'] = $nv_Request->cookie_domain;
$global_config ['site_url'] = $nv_Request->site_url;
$global_config ['my_domains'] = $nv_Request->my_domains;
$sys_info ['register_globals'] = $nv_Request->is_register_globals;
$sys_info ['magic_quotes_gpc'] = $nv_Request->is_magic_quotes_gpc;
$sys_info ['sessionpath'] = $nv_Request->session_save_path;
$client_info ['session_id'] = $nv_Request->session_id;
$client_info ['referer'] = $nv_Request->referer;
$client_info ['is_myreferer'] = $nv_Request->referer_key;
$client_info ['selfurl'] = $nv_Request->my_current_domain . $nv_Request->request_uri;
$client_info ['agent'] = $nv_Request->user_agent;
if (preg_match ( "/^[0-9]{10,}$/", $nv_Request->get_string ( 'nocache', 'get', '' ) ) and $client_info ['is_myreferer'] === 1)
	define ( 'NV_IS_AJAX', true );
if (NV_USER_AGENT == "none") {
	trigger_error ( 'We\'re sorry. The software you are using to access our website is not allowed. Some examples of this are e-mail harvesting programs and programs that will  copy websites to your hard drive. If you feel you have gotten this message  in error, please send an e-mail addressed to admin. Your I.P. address has been logged. Thanks.', 256 );
}
if (NV_USER_AGENT == 'NUKEVIET CMS ' . $global_config ['version'] . '. Developed by VINADES. Url: http://nukeviet.vn. Code: ' . md5 ( $global_config ['sitekey'] )) {
	define ( 'NV_IS_MY_USER_AGENT', true );
}
$client_info ['bot_info'] = nv_check_bot ();
$client_info ['is_bot'] = (! empty ( $client_info ['bot_info'] )) ? 1 : 0;
if ($client_info ['is_bot'] and empty ( $client_info ['bot_info'] ['allowed'] ))
	trigger_error ( 'Sorry! Website does not support the bot', 256 );
$client_info ['browser'] = $client_info ['is_bot'] ? array (
		'key' => "Unknown",
		'name' => 'Unknown' 
) : array_combine ( array (
		'key',
		'name' 
), explode ( "|", nv_getBrowser ( NV_USER_AGENT, NV_ROOTDIR . '/includes/ini/br.ini' ) ) );
$client_info ['is_mobile'] = nv_checkmobile ( NV_ROOTDIR . '/includes/ini/mobile.ini' );
if (defined ( 'NV_IS_FLOOD_BLOCKER' ) and NV_IS_FLOOD_BLOCKER == 1 and ! $nv_Request->isset_request ( 'admin', 'session' ) and (! $nv_Request->isset_request ( 'second', 'get' ) or ($nv_Request->isset_request ( 'second', 'get' ) and $client_info ['is_myreferer'] != 1))) {
	require (NV_ROOTDIR . '/includes/core/flood_blocker.php');
}
$client_info ['client_os'] = $client_info ['is_bot'] ? array (
		'key' => "Robot",
		'name' => $client_info ['bot_info'] ['name'] 
) : array_combine ( array (
		'key',
		'name' 
), explode ( "|", nv_getOs ( NV_USER_AGENT, NV_ROOTDIR . '/includes/ini/os.ini' ) ) );
if ($nv_Request->isset_request ( 'scaptcha', 'get' )) {
	include_once (NV_ROOTDIR . "/includes/core/captcha.php");
}
require (NV_ROOTDIR . '/includes/class/mysql.class.php');
$db_config ['new_link'] = NV_MYSQL_NEW_LINK;
$db_config ['persistency'] = NV_MYSQL_PERSISTENCY;
$db_config ['collation'] = NV_MYSQL_COLLATION;
$db = new sql_db ( $db_config );
if (! empty ( $db->error )) {
	$die = ! empty ( $db->error ['user_message'] ) ? $db->error ['user_message'] : $db->error ['message'];
	$die .= ! empty ( $db->error ['code'] ) ? ' (Code: ' . $db->error ['code'] . ')' : '';
	trigger_error ( $die, 256 );
}
unset ( $db_config ['dbpass'] );
define ( 'NV_AUTHORS_GLOBALTABLE', $db_config ['prefix'] . '_authors' );
define ( 'NV_GROUPS_GLOBALTABLE', $db_config ['prefix'] . '_groups' );
define ( 'NV_USERS_GLOBALTABLE', $db_config ['prefix'] . '_users' );
define ( 'NV_SESSIONS_GLOBALTABLE', $db_config ['prefix'] . '_sessions' );
define ( 'NV_LANGUAGE_GLOBALTABLE', $db_config ['prefix'] . '_language' );
define ( 'NV_BANNERS_CLIENTS_GLOBALTABLE', $db_config ['prefix'] . '_banners_clients' );
define ( 'NV_BANNERS_PLANS_GLOBALTABLE', $db_config ['prefix'] . '_banners_plans' );
define ( 'NV_BANNERS_ROWS_GLOBALTABLE', $db_config ['prefix'] . '_banners_rows' );
define ( 'NV_BANNERS_CLICK_GLOBALTABLE', $db_config ['prefix'] . '_banners_click' );
define ( 'NV_CONFIG_GLOBALTABLE', $db_config ['prefix'] . '_config' );
define ( 'NV_CRONJOBS_GLOBALTABLE', $db_config ['prefix'] . '_cronjobs' );
define ( 'NV_PREFIXLANG', $db_config ['prefix'] . '_' . NV_LANG_DATA );
define ( 'NV_MODULES_TABLE', NV_PREFIXLANG . '_modules' );
define ( 'NV_BLOCKS_TABLE', NV_PREFIXLANG . '_blocks' );
define ( 'NV_MODFUNCS_TABLE', NV_PREFIXLANG . '_modfuncs' );
define ( 'NV_COUNTER_TABLE', NV_PREFIXLANG . '_counter' );
define ( 'NV_SEARCHKEYS_TABLE', NV_PREFIXLANG . '_searchkeys' );
define ( 'NV_REFSTAT_TABLE', NV_PREFIXLANG . '_referer_stats' );
$sql = "SELECT `module`, `config_name`, `config_value` FROM `" . NV_CONFIG_GLOBALTABLE . "` WHERE `lang`='" . NV_LANG_DATA . "' ORDER BY `module` ASC";
$list = nv_db_cache ( $sql, '', 'settings' );
foreach ( $list as $row ) {
	if ($row ['module'] == "global") {
		$global_config [$row ['config_name']] = $row ['config_value'];
	} else {
		$module_config [$row ['module']] [$row ['config_name']] = $row ['config_value'];
	}
}
if (! isset ( $global_config ['upload_checking_mode'] ) or ! in_array ( $global_config ['upload_checking_mode'], array (
		"mild",
		"lite",
		"none" 
) )) {
	$global_config ['upload_checking_mode'] = "strong";
}
define ( 'UPLOAD_CHECKING_MODE', $global_config ['upload_checking_mode'] );
if (! empty ( $newCountry )) {
	if ($db->sql_query ( "INSERT INTO `" . $db_config ['prefix'] . "_ipcountry` VALUES (" . $newCountry ['ip_from'] . ", " . $newCountry ['ip_to'] . ", '" . $newCountry ['code'] . "', '" . $newCountry ['ip_file'] . "', " . NV_CURRENTTIME . ")" )) {
		$time_del = NV_CURRENTTIME - 604800;
		$db->sql_query ( "DELETE FROM `" . $db_config ['prefix'] . "_ipcountry` WHERE `ip_file`='" . $newCountry ['ip_file'] . "' AND `country`='ZZ' AND `time` < " . $time_del );
		$result = $db->sql_query ( "SELECT `ip_from`, `ip_to`, `country` FROM `" . $db_config ['prefix'] . "_ipcountry` WHERE `ip_file`='" . $newCountry ['ip_file'] . "'" );
		$array_ip_file = array ();
		while ( $row = $db->sql_fetch_assoc ( $result ) ) {
			$array_ip_file [] = $row ['ip_from'] . " => array(" . $row ['ip_to'] . ", '" . $row ['country'] . "')";
		}
		file_put_contents ( NV_ROOTDIR . "/" . NV_DATADIR . "/ip_files/" . $newCountry ['ip_file'] . ".php", "<?php\n\n\$ranges = array(" . implode ( ', ', $array_ip_file ) . ");\n\n?>", LOCK_EX );
	}
	unset ( $newCountry, $time_del, $array_ip_file, $result, $row );
}
if ($global_config ['is_url_rewrite']) {
	$check_rewrite_file = nv_check_rewrite_file ();
	if ($check_rewrite_file) {
		require (NV_ROOTDIR . "/includes/rewrite.php");
	} else {
		require (NV_ROOTDIR . "/includes/rewrite_index.php");
	}
	if (preg_match ( "/^" . nv_preg_quote ( NV_BASE_SITEURL . "index.php?" ) . "/i", $_SERVER ['REQUEST_URI'] )) {
		$url_rewrite = nv_url_rewrite ( $_SERVER ['REQUEST_URI'], true );
		if ($url_rewrite != $_SERVER ['REQUEST_URI']) {
			Header ( "Location: " . $url_rewrite );
			die ();
		}
	} elseif ($global_config ['rewrite_optional'] && preg_match ( "/^" . nv_preg_quote ( NV_BASE_SITEURL . NV_LANG_DATA . "/" ) . "/i", $_SERVER ['REQUEST_URI'] )) {
		$url_rewrite = preg_replace ( "/^" . nv_preg_quote ( NV_BASE_SITEURL . NV_LANG_DATA . "/" ) . "(.*)$/", NV_BASE_SITEURL . "\\1", $_SERVER ['REQUEST_URI'] );
		Header ( "Location: " . $url_rewrite );
		die ();
	} elseif ($global_config ['rewrite_optional'] && preg_match ( "/^" . nv_preg_quote ( NV_BASE_SITEURL . "index.php/" . NV_LANG_DATA . "/" ) . "/i", $_SERVER ['REQUEST_URI'] )) {
		$url_rewrite = preg_replace ( "/^" . nv_preg_quote ( NV_BASE_SITEURL . "index.php/" . NV_LANG_DATA . "/" ) . "(.*)$/", NV_BASE_SITEURL . "\\1", $_SERVER ['REQUEST_URI'] );
		Header ( "Location: " . $url_rewrite );
		die ();
	}
} elseif (empty ( $global_config ['lang_multi'] ) and $global_config ['rewrite_optional']) {
	require (NV_ROOTDIR . "/includes/rewrite_language.php");
	if (preg_match ( "/^" . nv_preg_quote ( NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA ) . "/i", $_SERVER ['REQUEST_URI'] )) {
		$url_rewrite = nv_url_rewrite ( $_SERVER ['REQUEST_URI'], true );
		if ($url_rewrite != $_SERVER ['REQUEST_URI']) {
			Header ( "Location: " . $url_rewrite );
			die ();
		}
	}
}
if (defined ( 'NV_ADMIN' )) {
	if (! in_array ( NV_LANG_DATA, $global_config ['allow_adminlangs'] )) {
		if ($global_config ['lang_multi']) {
			$nv_Request->set_Cookie ( 'data_lang', $global_config ['site_lang'], NV_LIVE_COOKIE_TIME );
		}
		Header ( "Location: " . NV_BASE_ADMINURL );
		exit ();
	}
	if (! in_array ( NV_LANG_INTERFACE, $global_config ['allow_adminlangs'] )) {
		if ($global_config ['lang_multi']) {
			$nv_Request->set_Cookie ( 'int_lang', $global_config ['site_lang'], NV_LIVE_COOKIE_TIME );
		}
		Header ( "Location: " . NV_BASE_ADMINURL );
		exit ();
	}
}
require (NV_ROOTDIR . '/includes/class/crypt.class.php');
$crypt = new nv_Crypt ( $global_config ['sitekey'], NV_CRYPT_SHA1 == 1 ? 'sha1' : 'md5' );
if (! $crypt->_otk)
	trigger_error ( "sitekey not declared", 256 );
if ($nv_Request->isset_request ( 'second', 'get' ) and $nv_Request->get_string ( 'second', 'get' ) == "cronjobs") {
	include_once (NV_ROOTDIR . "/includes/core/cronjobs.php");
}
if (defined ( 'NV_IS_ADMIN' ) || defined ( 'NV_IS_SPADMIN' )) {
	trigger_error ( "Hacking attempt", 256 );
}
define ( 'ADMIN_LOGIN_MODE', (empty ( $global_config ['closed_site'] )) ? 3 : $global_config ['closed_site'] );
$admin_cookie = $nv_Request->get_bool ( 'admin', 'session', false );
if (! empty ( $admin_cookie )) {
	require (NV_ROOTDIR . "/includes/core/admin_access.php");
	require (NV_ROOTDIR . "/includes/core/is_admin.php");
}
if (defined ( "NV_IS_ADMIN" )) {
	if (empty ( $admin_info ['checkpass'] )) {
		if ($nv_Request->isset_request ( NV_ADMINRELOGIN_VARIABLE, 'get' ) and $nv_Request->get_int ( NV_ADMINRELOGIN_VARIABLE, 'get' ) == 1) {
			require (NV_ROOTDIR . "/includes/core/admin_relogin.php");
			exit ();
		}
	}
} elseif (! in_array ( NV_LANG_DATA, $global_config ['allow_sitelangs'] )) {
	$global_config ['closed_site'] = 1;
}
if (! defined ( 'NV_ADMIN' ) and ! defined ( "NV_IS_ADMIN" )) {
	if (! empty ( $global_config ['closed_site'] )) {
		$disable_site_content = (isset ( $global_config ['disable_site_content'] ) and ! empty ( $global_config ['disable_site_content'] )) ? $global_config ['disable_site_content'] : $lang_global ['disable_site_content'];
		nv_info_die ( $global_config ['site_description'], $global_config ['disable_site_title'], $disable_site_content );
	} elseif (! in_array ( NV_LANG_DATA, $global_config ['allow_sitelangs'] )) {
		Header ( "Location: " . NV_BASE_SITEURL );
		exit ();
	} elseif (empty ( $global_config ['lang_multi'] ) and NV_LANG_DATA != $global_config ['site_lang']) {
		Header ( "Location: " . NV_BASE_SITEURL );
		exit ();
	}
}
define ( 'PCLZIP_TEMPORARY_DIR', NV_ROOTDIR . '/' . NV_TEMP_DIR . '/' );

?>